<!--
 * @Author: 李天惊 uf_lee@163.com
 * @Date: 2022-11-10 16:37:30
 * @LastEditors: 李天惊 uf_lee@163.com
 * @LastEditTime: 2022-12-07 20:53:46
 * @FilePath: \grazlink20\uc_sys\src\views\Shop\Income\components\See.vue
 * Copyright (c) 2022 by 李天惊 uf_lee@163.com, All Rights Reserved. 
-->
<script setup lang="ts">
import { PropType, ref, reactive } from 'vue'
import { adminCsIncomeSeeApi } from '@/api/cs/income'
import { LeeSee } from '@/components/Lee/See'
import { ContentWrap } from '@/components/ContentWrap'
import { UploadMultiple } from '@/components/UploadMultiple'
// 获取字典
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()
const dict: any = wsCache.get('dict')

const props = defineProps({
  currentRow: {
    type: Object as PropType<Nullable<any>>,
    default: () => null
  }
})

const data = ref<any>({})

const schema = reactive<any[]>([
  {
    field: 'income_id',
    label: '主键',
    width: 100
  },
  {
    field: 'income_sn',
    label: '入款单编号',
    width: 200
  },
  {
    field: 'order_sn',
    label: '订单编号',
    width: 100
  },
  {
    field: 'org_name',
    label: '组织名称',
    width: 100
  },
  {
    field: 'shop_name',
    label: '店铺名称',
    width: 100
  },
  {
    field: 'user_name',
    label: '汇款用户',
    width: 100
  },
  {
    field: 'amount',
    label: '汇款金额'
  },
  {
    field: 'status',
    label: '状态',
    component: 'Dict',
    componentProps: { options: dict.cs_income_status }
  },
  {
    field: 'create_time',
    label: '创建时间',
    width: 180
  }
])

const seeApi = async () => {
  const res: any = await adminCsIncomeSeeApi({ income_id: props.currentRow.income_id })
    .catch(() => {})
    .finally(() => {})
  if (res) {
    data.value = res.data
  }
}

/****************************** 初始化 start ******************************/

const init = async () => {
  // 先调查看详情接口
  await seeApi()
}
init()

/****************************** 初始化 end ******************************/
</script>

<template>
  <LeeSee :schema="schema" :data="data" />

  <div class="p-10px">
    <ContentWrap title="凭证">
      <UploadMultiple
        ref="goodsCarouselRef"
        v-model="data.knData"
        :response="{
          url: 'img_url',
          file_type: 'fileType'
        }"
        disabled
      />
    </ContentWrap>
  </div>
</template>
